package class3;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class demo4 {
    public static void main(String[] args) {
        FileInputStream in=null;
        FileOutputStream out=null;
        long startTime=System.currentTimeMillis();
        try {
            in=new FileInputStream("D:\\line.png");
            out=new FileOutputStream("D:\\temp\\test\\line.png");
            int len=0;
            byte[]b=new byte[1024];

            while ((len=in.read(b))!=-1){
                out.write(b);
            }

        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            try {
                if (out!=null){
                    out.close();
                }
                if (in!=null){
                    in.close();
                }
                System.out.println(System.currentTimeMillis()-startTime);
                System.out.println("复制成功");
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
